import request from '@/config/axios'

// 账单分类 VO
export interface CateVO {
  id: number // ID
  clsName: string // 分类
  amountType: string // 收支类型
  parentId: number // 父ID
  orderNum: number // 排序号
  remark: string // 批注
}

// 账单分类 API
export const CateApi = {
  // 查询账单分类列表
  getCateList: async (params) => {
    return await request.get({ url: `/bill/cate/list`, params })
  },

  // 查询账单分类树
  getCateTree: async (params) => {
    return await request.get({ url: `/bill/cate/tree`, params })
  },

  // 查询账单分类详情
  getCate: async (id: number) => {
    return await request.get({ url: `/bill/cate/get?id=` + id })
  },

  // 新增账单分类
  createCate: async (data: CateVO) => {
    return await request.post({ url: `/bill/cate/create`, data })
  },

  // 修改账单分类
  updateCate: async (data: CateVO) => {
    return await request.put({ url: `/bill/cate/update`, data })
  },

  // 删除账单分类
  deleteCate: async (id: number) => {
    return await request.delete({ url: `/bill/cate/delete?id=` + id })
  },

  // 导出账单分类 Excel
  exportCate: async (params) => {
    return await request.download({ url: `/bill/cate/export-excel`, params })
  }
}
